package com.docker.core.interceptor;

import com.docker.core.mvc.Remark;
import com.jfinal.kit.Base64Kit;
import com.jfinal.kit.JsonKit;
import com.jfinal.render.JsonRender;
import com.jfinal.render.Render;
import com.jfinal.render.RenderFactory;
import com.jfinal.render.TextRender;

/**
 * @Author ldl
 * @Create 2020/07/27 027 15:01
 */
@Remark("响应参数拦截处理")
public class ResponseRender extends RenderFactory {

    public ResponseRender() {
        super();
    }

    @Override
    public Render getJsonRender(String str) {
        //测试：对响应参数进行base64加密
        return new JsonRender(Base64Kit.encode(str));
    }

    @Override
    public Render getJsonRender(Object object) {
        //测试：对响应参数进行base64加密
        return getJsonRender(JsonKit.toJson(object));
    }

    @Override
    public Render getTextRender(String text) {
        //测试：对响应参数进行base64加密
        return new TextRender(Base64Kit.encode(text));
    }

}
